package sweezy.swf.tools.flex
{
	import mx.controls.Tree;
	import mx.events.ListEvent;

	public class SWFTreeView extends Tree
	{

		public function SWFTreeView()
		{
			showRoot = false;
			dataDescriptor = new SWFNodeDataDescriptor();
		}

		override protected function createChildren():void
		{
			super.createChildren();

			addEventListener(ListEvent.ITEM_CLICK, itemClickHandler);
		}

		private function itemClickHandler(e:ListEvent):void
		{
			expandItem(e.itemRenderer.data, !isItemOpen(e.itemRenderer.data), true);
		}
	}
}
